
direction=int(input())
straight, left, right = input().split()
straight, left, right = int(straight), int(left), int(right)


if direction==1:
    if straight==0:
        print("wait")
    elif straight==1:
        print("pass")
if direction==2:
    if left==0:
        print("wait")
    elif left==1:
        print("pass")
if direction==-1:
    if left==0:
        print("wait")
    elif left==1:
        print("pass")
if direction==-2:
    if right==0:
        print("wait")
    elif right==1:
        print("pass")